﻿using Abp.AspNetCore.Mvc.Views;
using Abp.Dependency;
using Abp.Runtime.Session;
using KelonProud.Administration.Dtos;
using KelonProud.Administration.Services;
using Microsoft.AspNetCore.Mvc.Razor.Internal;

namespace KelonProud.Administration
{
    public abstract class KelonProudRazorPage<TModel> : AbpRazorPage<TModel>
    {
        [RazorInject]
        public IAbpSession AbpSession { get; set; }

        private readonly IUserAppService _userAppService;
        private readonly IKelonProudSettingAppService _settingAppservice;
        private readonly INavigationProvider _navigationProvider;

        protected KelonProudRazorPage()
        {
            _navigationProvider = IocManager.Instance.Resolve<INavigationProvider>();
            _userAppService = IocManager.Instance.Resolve<IUserAppService>();
            _settingAppservice = IocManager.Instance.Resolve<IKelonProudSettingAppService>();
            LocalizationSourceName = KelonProudConsts.LocalizationSourceName;
        }

        public UserOutputDto UserInfo => _userAppService.GetCurrentUserInfo();

        public string ThemeUi => _settingAppservice.GetThemeUiSettingValue();

        public bool IsHasTenantId => AbpSession.TenantId.HasValue;
    }
}
